﻿// <copyright file="Polygon.cs" company="ThorIndustry">Copyright (c) ThorIndustry. All rights reserved.</copyright>

public class Polygon
{
    [System.Xml.Serialization.XmlAttribute]
    public string Name
    {
        get;
        set;
    }
     
    [System.Xml.Serialization.XmlIgnore]
    public UnityEngine.Vector2[] Points
    {
        get;
        set;
    }

    [System.Xml.Serialization.XmlElement(ElementName = "Point", Type = typeof(Point))]
    public Point[] XmlSerializablePoints
    {
        get
        {
            Point[] points = new Point[this.Points.Length];
            for (int index = 0; index < points.Length; ++index)
            {
                points[index] = new Point() { X = this.Points[index].x, Y = this.Points[index].y };
            }

            return points;
        }

        set
        {
            this.Points = new UnityEngine.Vector2[value.Length];
            for (int index = 0; index < value.Length; ++index)
            {
                this.Points[index] = new UnityEngine.Vector2(value[index].X, value[index].Y);
            }
        }
    }
}
